using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Resources;

using SypConst.Garbage;

namespace SypGui.CreateForms
{
    public partial class SypFormDesign : Form
    {
        protected ResourceSet CurrentResource = null;
        protected SetText OutputMethod = null;
        protected bool timeToClose = false;

        protected string GetRessources(string key)
        {
            if (CurrentResource != null)
                return CurrentResource.GetString(key);
            return null;
        }

        public void ItsAboutTimeToClose()
        {
            timeToClose = true;
        }

        public void InitPosition()
        {
            this.CenterToScreen();
        }

        protected virtual void InitializeRessources() { }

        public SypFormDesign()
        {     
            InitializeComponent();
            ResourceManager resourceManager = new ResourceManager("Syp.Resources", GetType().Assembly);
            if (SypGarbageConf.Instance() != null)
                CurrentResource = resourceManager.GetResourceSet(new CultureInfo(SypGarbageConf.Instance().Language), true, false);
            else
                CurrentResource = resourceManager.GetResourceSet(new CultureInfo("en-US"), true, false);
            SypGarbage.free(resourceManager);
            InitializeRessources();
        }

        public SypFormDesign(SetText OutputMethod)
        {
            this.OutputMethod = OutputMethod;
            InitializeComponent();
            ResourceManager resourceManager = new ResourceManager("Syp.Resources", GetType().Assembly);
            if (SypGarbageConf.Instance() != null)
                CurrentResource = resourceManager.GetResourceSet(new CultureInfo(SypGarbageConf.Instance().Language), true, false);
            else
                CurrentResource = resourceManager.GetResourceSet(new CultureInfo("en-US"), true, false);
            SypGarbage.free(resourceManager);
            InitializeRessources();
        }

    }
}